package com.controller;

import java.util.List;
import java.util.Map;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.dao.Fund;
import com.dao.Users;
import com.util.MySqlSessionFactory;

@Controller
public class FundController {
	@RequestMapping(value = "/queryMthin.action", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> queryMthin(
			@CookieValue(value = "user", defaultValue = "") String userid,
			HttpServletResponse response) {
		SqlSession sql = MySqlSessionFactory.getSqlSession();
		Fund dao = sql.getMapper(Fund.class);
		Map<String, Object> map = dao.queryMthin(userid);
		return map;
	}

	@RequestMapping(value = "/queryMthout.action", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> queryMthout(
			@CookieValue(value = "user", defaultValue = "") String userid,
			HttpServletResponse response) {
		SqlSession sql = MySqlSessionFactory.getSqlSession();
		Fund dao = sql.getMapper(Fund.class);
		Map<String, Object> map = dao.queryMthout(userid);
		return map;
	}

	@RequestMapping(value = "/querylin.action", method = RequestMethod.GET)
	@ResponseBody
	public List<Map<String, Object>> querylin(
			@CookieValue(value = "user", defaultValue = "") String userid,
			HttpServletResponse response) {
		SqlSession sql = MySqlSessionFactory.getSqlSession();
		Fund dao = sql.getMapper(Fund.class);
		List<Map<String, Object>> map = dao.querylin(userid);
		return map;
	}

	@RequestMapping(value = "/querylout.action", method = RequestMethod.GET)
	@ResponseBody
	public List<Map<String, Object>> querylout(
			@CookieValue(value = "user", defaultValue = "") String userid,
			HttpServletResponse response) {
		SqlSession sql = MySqlSessionFactory.getSqlSession();
		Fund dao = sql.getMapper(Fund.class);
		List<Map<String, Object>> map = dao.querylout(userid);
		return map;
	}

}
